class CreateGuideInvolveds < ActiveRecord::Migration
  def self.up
    create_table :guide_involveds do |t|
      t.references :tour_group, :null => false
      t.references :guide
      t.decimal :food_cost, :precision => 8, :scale => 2, :default => 0, :null => false
      t.decimal :attraction_ticket_cost, :precision => 8, :scale => 2, :default => 0, :null => false
      t.decimal :subsidy_for_guide, :precision => 8, :scale => 2, :default => 0, :null => false
      t.timestamps
    end
    execute "ALTER TABLE guide_involveds ADD CONSTRAINT fk_guide_involved_tour_group FOREIGN KEY (tour_group_id) REFERENCES tour_groups(id)"
  end

  def self.down
    drop_table :guide_involveds
  end
end
